package edu.ntu.cloudroid.model.function.similar;

import edu.ntu.cloudroid.model.data.LocationData;
import edu.ntu.cloudroid.model.data.LocationInfo;
import edu.ntu.cloudroid.model.data.VitalSignData;

public class VitalSignSimilar implements ISimilarFunc{

	
	
	@Override
	public boolean isSimilar(Object object1, Object object2, int colIdx,
			int granularity, double range) throws Exception{
		
		VitalSignData vsd1 = (VitalSignData)object1;
		VitalSignData vsd2 = (VitalSignData)object2;
		double val1, val2;
		val1 = colIdx==0?vsd1.getHeartRate():vsd1.getOxygenVolume();
		val2 = colIdx==0?vsd2.getHeartRate():vsd2.getOxygenVolume();		
		return Math.abs(val1-val2)<=range;
	}	
}
